package com.qkl.common.publics.web.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class AppWebConfig extends WebMvcConfigurationSupport {

    @Autowired
    private HandlerInterceptor appInterceptor;

    @Value("${public.baseURL}")
    private String baseURL;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(appInterceptor).addPathPatterns(baseURL + "/*", baseURL + "/*/*");
        super.addInterceptors(registry);
    }
}
